package com.YCH.model.mappers.app;

import com.YCH.model.behavior.pojos.TbLikesBehavior;
import org.apache.ibatis.annotations.Param;

public interface TbLikesBehaviorMapper {
    /**
     * 选择最后一条喜欢按钮
     * @return
     */
    TbLikesBehavior selectLastLike(@Param("userId")Long userId, @Param("articleId")Long articleId,@Param("commentId")Long commentId,@Param("commentReplayId")Long commentReplayId,@Param("type") Short type);

    /**
     * 点赞接口
     * @param record
     * @return
     */
    int insert(TbLikesBehavior record);

    /**
     * 查询点赞数量
     * @param type
     * @return
     */
    Integer selectAllCount(@Param("articleId")Long articleId,@Param("commentId")Long commentId,@Param("commentReplayId")Long commentReplayId,short type);

    /**
     * 查询是否取消点赞
     * @param userId
     * @param articleId
     * @param type
     * @return
     */
    TbLikesBehavior selectCancleLike(@Param("userId") Long userId,@Param("articleId") Long articleId,@Param("commentId")Long commentId,@Param("commentReplayId")Long commentReplayId,@Param("type") short type);

    /**
     * 取消点赞
     * @return
     */
    Integer updata(TbLikesBehavior record);

    /**
     * 根据用户id查询所有已经点赞的文章数量
     * @param userId
     * @param operation
     * @return
     */
    Integer selectAllArticleCountByUserId(@Param("userId")Long userId,@Param("operation") short operation);

    /**
     * 根据用户id查询所有已经点赞的评论数量
     * @param userId
     * @param operation
     * @return
     */
    Integer selectAllCommentCountByUserId(@Param("userId")Long userId,@Param("operation") short operation);

    Integer selectAllcommentReplayCountByUserId(@Param("userId")Long userId,@Param("operation")short operation);
}